<?php
/**
 * Each engineer has a duty to keep the code elegant
 * Created by wolffy.
 * Author @wolffy<13750088090@sina.cn>
 * Date: 2018/8/12
 * Time: 11:40
 */
namespace App\Repositories;

use App\Models\UserLevelPassage;

class UserLevelPassageRepository
{
    /**
     * 根据id获取还款账单资料
     * @param $id
     * @return mixed
     */
    public function byId($id)
    {
        return UserLevelPassage::find($id);
    }

    public function first($passageId, $userLevelId)
    {
        return UserLevelPassage::where([
            'passage_id' => $passageId,
            'level_id' => $userLevelId
        ])->first();
    }

    public function byPassageGet($passageId)
    {
        return UserLevelPassage::where('passage_id', $passageId)
            ->select('level_id', 'rate', 'second_rate')
            ->get();
    }
}